package cn.iocoder.yudao.module.shop.revenue.service.app;

import cn.iocoder.yudao.framework.business.basic.dao.query.CoreQueryWrapper;
import cn.iocoder.yudao.framework.business.basic.service.PageService;
import cn.iocoder.yudao.framework.business.basic.service.impl.BaseService;
import cn.iocoder.yudao.module.shop.revenue.dao.RevenueMapper;
import cn.iocoder.yudao.module.shop.revenue.pojo.dto.RevenueQueryDTO;
import cn.iocoder.yudao.module.shop.revenue.pojo.po.ShopRevenue;
import cn.iocoder.yudao.module.shop.revenue.pojo.vo.RevenueVO;
import jakarta.annotation.Nonnull;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;

/**
 * <pre>
 * OOoO0OOoO0OOOooo0oOOOO0OOOOO0oooOO0ooOOO0Ooooo0OOOOo0ooooO0OOooo0Ooooo0OOOOO
 * 服务
 * OOoO0OOoO0OOOooo0oOOOO0OOOOO0oooOO0ooOOO0Ooooo0OOOOo0ooooO0OOooo0Ooooo0OOOOO
 * </pre>
 *
 * @author 山野羡民（1032694760@qq.com）
 * @since 2025/04/30
 */
@Service
public class AppRevenueService extends BaseService<ShopRevenue, RevenueVO, RevenueQueryDTO> implements PageService<RevenueVO, RevenueQueryDTO> {
    @Resource
    private RevenueMapper revenueMapper;

    @Override
    public RevenueMapper getInjectedMapper() {
        return revenueMapper;
    }

    @Nonnull
    @Override
    protected CoreQueryWrapper<ShopRevenue> buildQueryWrapper(RevenueQueryDTO param) {
        CoreQueryWrapper<ShopRevenue> wrapper = super.buildQueryWrapper(param);
        wrapper.eqIfPresent("status", param.getStatus());
        wrapper.eqIfPresent("shop_id", param.getShopId());
        wrapper.betweenIfPresent("create_time", param.buildCreateTime());
        wrapper.orderByDesc("id");
        return wrapper;
    }

    public Integer getNumberSum(RevenueQueryDTO param) {
        return getInjectedMapper().selectNumberSum(param);
    }

}
